package com.ruoyi.project.wx.service.impl;


import com.ruoyi.project.wx.dao.GoodsBrandDao;
import com.ruoyi.project.wx.dao.GoodsTypeBrandDao;
import com.ruoyi.project.wx.domain.GoodsTypeBrandDO;
import com.ruoyi.project.wx.service.GoodsTypeBrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service
public class GoodsTypeBrandServiceImpl implements GoodsTypeBrandService {
	@Autowired
	private GoodsTypeBrandDao goodsTypeBrandDao;
	@Autowired
	private GoodsBrandDao goodsBrandDao;
	
	@Override
	public GoodsTypeBrandDO get(String id){
		return goodsTypeBrandDao.get(id);
	}
	
	@Override
	public List<GoodsTypeBrandDO> list(Map<String, Object> map){
		return goodsTypeBrandDao.list(map);
	}
	
	@Override
	public int count(Map<String, Object> map){
		return goodsTypeBrandDao.count(map);
	}
	
	@Override
	public int save(GoodsTypeBrandDO goodsTypeBrand){
		return goodsTypeBrandDao.save(goodsTypeBrand);
	}
	
	@Override
	public int update(GoodsTypeBrandDO goodsTypeBrand){
		return goodsTypeBrandDao.update(goodsTypeBrand);
	}
	
	@Override
	public int remove(String id){
		return goodsTypeBrandDao.remove(id);
	}
	
	@Override
	public int batchRemove(String[] ids){
		return goodsTypeBrandDao.batchRemove(ids);
	}

	@Override
	public List<GoodsTypeBrandDO> queryAndBrandByTypeId(String typeId) {
		List<GoodsTypeBrandDO> list = goodsTypeBrandDao.queryByTypeId(typeId);
		if (list!=null && list.size()>0){
			for (GoodsTypeBrandDO typeBrandDO:list){
				typeBrandDO.setBrand(goodsBrandDao.get(typeBrandDO.getBrandid()));
			}
		}
		return list;
	}
	
}
